home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Sprite 1984 - 1993
/
Sprite 1984 - 1993.iso
/
src
/
lib
/
c
/
unixSyscall
/
RCS
/
chown.c,v
< prev
next >
Wrap
Text File
|
1991-12-10
|
5KB
|
223 lines
head 1.3;
branch ;
access ;
symbols sprited:1.3.1;
locks ; strict;
comment @ * @;
1.3
date 88.08.25.14.41.09; author brent; state Exp;
branches 1.3.1.1;
next 1.2;
1.2
date 88.08.08.14.22.07; author ouster; state Exp;
branches ;
next 1.1;
1.1
date 88.06.19.14.31.05; author ouster; state Exp;
branches ;
next ;
1.3.1.1
date 91.12.10.15.41.43; author kupfer; state Exp;
branches ;
next ;
desc
@@
1.3
log
@Re-implemented using the new Fs_SetAttr system call
@
text
@/*
* chown.c --
*
* Procedures to map from Unix chown and fchown system calls
* to Sprite system call.
*
* Copyright 1987 Regents of the University of California
* All rights reserved.
*/
#ifndef lint
static char rcsid[] = "$Header: chown.c,v 1.2 88/08/08 14:22:07 ouster Exp $ SPRITE (Berkeley)";
#endif not lint
#include "sprite.h"
#include "fs.h"
#include "compatInt.h"
#include <errno.h>
/*
*----------------------------------------------------------------------
*
* chown --
*
* Procedure to map from Unix chown system call to Sprite
* Fs_SetAttr system call.
*
* Results:
* UNIX_SUCCESS - the call was successful.
* UNIX_ERROR - the call was not successful.
* The actual error code stored in errno.
*
* Side effects:
* The protection of the specified file is modified.
*
*----------------------------------------------------------------------
*/
int
chown(path, owner, group)
char *path;
int owner;
int group;
{
ReturnStatus status; /* result returned by Sprite system calls */
Fs_Attributes attributes; /* struct containing all file attributes.
* only ownership is looked at. */
attributes.uid = owner;
attributes.gid = group;
status = Fs_SetAttr(path, FS_ATTRIB_LINK, &attributes, FS_SET_OWNER);
if (status != SUCCESS) {
errno = Compat_MapCode(status);
return(UNIX_ERROR);
} else {
return(UNIX_SUCCESS);
}
}
/*
*----------------------------------------------------------------------
*
* fchown --
*
* Procedure to map from Unix fchown system call to Sprite
* Fs_SetAttrID system call.
*
* Results:
* UNIX_SUCCESS - the call was successful.
* UNIX_ERROR - the call was not successful.
* The actual error code stored in errno.
*
* Side effects:
* The protection of the specified file is modified.
*
*----------------------------------------------------------------------
*/
int
fchown(fd, owner, group)
int fd;
int owner;
int group;
{
ReturnStatus status; /* result returned by Sprite system calls */
Fs_Attributes attributes; /* struct containing all file attributes,
* only ownship info is looked at. */
attributes.uid = owner;
attributes.gid = group;
status = Fs_SetAttrID(fd, &attributes, FS_SET_OWNER);
if (status != SUCCESS) {
errno = Compat_MapCode(status);
return(UNIX_ERROR);
} else {
return(UNIX_SUCCESS);
}
}
@
1.3.1.1
log
@Initial branch for Sprite server.
@
text
@d12 1
a12 1
static char rcsid[] = "$Header: /sprite/src/lib/c/unixSyscall/RCS/chown.c,v 1.3 88/08/25 14:41:09 brent Exp $ SPRITE (Berkeley)";
@
1.2
log
@Must affect LINK, not file.
@
text
@d12 1
a12 1
static char rcsid[] = "$Header: chown.c,v 1.1 88/06/19 14:31:05 ouster Exp $ SPRITE (Berkeley)";
d28 1
a28 1
* Fs_SetAttributes system call.
d47 3
a49 2
ReturnStatus status; /* result returned by Sprite system calls */
Fs_Attributes attributes; /* struct containing all file attributes */
d51 3
a53 1
status = Fs_GetAttributes(path, FS_ATTRIB_LINK, &attributes);
a56 11
}
if (owner != -1) {
attributes.uid = owner;
}
if (group != -1) {
attributes.gid = group;
}
status = Fs_SetAttributes(path, FS_ATTRIB_LINK, &attributes);
if (status != SUCCESS) {
errno = Compat_MapCode(status);
return(UNIX_ERROR);
d69 1
a69 1
* Fs_SetAttributesID system call.
d88 3
a90 2
ReturnStatus status; /* result returned by Sprite system calls */
Fs_Attributes attributes; /* struct containing all file attributes */
d92 3
a94 12
status = Fs_GetAttributesID(fd, &attributes);
if (status != SUCCESS) {
errno = Compat_MapCode(status);
return(UNIX_ERROR);
}
if (owner != -1) {
attributes.uid = owner;
}
if (group != -1) {
attributes.gid = group;
}
status = Fs_SetAttributesID(fd, &attributes);
@
1.1
log
@Initial revision
@
text
@d12 1
a12 1
static char rcsid[] = "$Header: chown.c,v 1.1 87/03/23 16:31:29 douglis Exp $ SPRITE (Berkeley)";
d50 1
a50 1
status = Fs_GetAttributes(path, FS_ATTRIB_FILE, &attributes);
d61 1
a61 1
status = Fs_SetAttributes(path, FS_ATTRIB_FILE, &attributes);
@